/*************************************************
 * File:    		SMXMLDOM.h.cpp
 * Author:  	HouJiong <hou_jiong@163.com>
 * Brief:   		StoneMoneky project.
 *
 * Copyright (c) HouJiong
 *
 *************************************************/

/*
 * History:
 * =======================================
 * 2009-04-10 HouJiong <hou_jiong@163.com> created
 */
 
#ifndef _SMXMLDOM_H_
#define _SMXMLDOM_H_

#include "SMtypedef.h"



class Element
{
public:
	Element();
	
	std::string getAttribute(std::string attribute);
	void setAttribute(std::string attribute, std::string value);

private:
	std::string m_id;
	std::string m_tag;
		
	std::string m_y;
	std::string m_x;
	std::string m_width;
	std::string m_height;
	
	std::string m_text;
	std::string m_src;

	std::string m_onClicked;	
};

typedef std::list<Element> ElementList;

class SMXMLDOM
{
public:
	SMXMLDOM();
	
	bool loadXML(std::string xmlfile);
	
	ElementList&  getElementList(){return m_ElementList;}
	


private:
	bool parse(xmlNode *parentXMLNode);
	
	
private:
	ElementList m_ElementList;
	xmlDoc *m_xmldoc;
	xmlNode *m_xmlrootnode; 

};
#endif //_SMXMLDOM_H_
